package com.hotel.services.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hotel.daos.FixMapper;
import com.hotel.entitys.Fix;
import com.hotel.services.FixService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class FixServiceImpl implements FixService {
    @Autowired
    private FixMapper fixMapper;

    @Override
    public PageInfo<Fix> getAllFix(Integer currentPage, Integer pageSize, String keyword) {
        PageHelper.startPage(currentPage,pageSize);
        List<Fix> list = fixMapper.selectAllFix(keyword);
        PageInfo<Fix> pageInfo = new PageInfo<Fix>(list);
        return pageInfo;
    }
    @Override
    public int addFix(Fix fix) {
        return fixMapper.insertFix(fix);
    }

    @Override
    public int updateFix(Integer fix_id) {
        return fixMapper.updateFixById(fix_id);
    }
}
